package com.lefevre.cms.web.action.common;

import com.lefevre.cms.service.theme.ThemeService;
import com.lefevre.cms.web.action.AccessDeviceUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 用户协议
 */
@Controller
public class AgreementAction {

    @Resource
    AccessDeviceUtil accessDeviceUtil;
    @Resource(name = "themeServiceImpl")
    private ThemeService themeService;

    @RequestMapping("/agreement")
    public String execute(ModelMap model, HttpServletRequest request) throws Exception {

        //当前模板使用的目录
        String dirName = themeService.findTemplateDir_cache();

        return "/templates/" + dirName + "/" + accessDeviceUtil.accessDevices(request) + "/agreement";
    }
}
